package com.dynamixsoftware.printershare;

import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.res.Resources;
import android.database.DataSetObserver;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import com.dynamixsoftware.printershare.bjnp.BJNPSocket;
import com.dynamixsoftware.printershare.bt.BTAdapter;
import com.dynamixsoftware.printershare.bt.BTDevice;
import com.dynamixsoftware.printershare.bt.BTSocket;
import com.dynamixsoftware.printershare.data.Printer;
import com.dynamixsoftware.printershare.data.User;
import com.dynamixsoftware.printershare.ipp.IppAttribute;
import com.dynamixsoftware.printershare.ipp.IppConnection;
import com.dynamixsoftware.printershare.ipp.IppMessage;
import com.dynamixsoftware.printershare.smb.NtlmPasswordAuthentication;
import com.dynamixsoftware.printershare.smb.SmbAuthException;
import com.dynamixsoftware.printershare.smb.SmbFile;
import com.flurry.android.FlurryAgent;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.URL;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.List;
import java.util.Stack;
import java.util.UUID;
import java.util.Vector;

public class ActivityLocalPrinters
  extends ActivityCore
{
  private static final int SCAN_TYPE_BT = 1;
  private static final int SCAN_TYPE_USB = 2;
  private static final int SCAN_TYPE_WIFI;
  private static Printer xprn;
  private PrinterAdapter adapter;
  private AlertDialog dialog_authorization;
  private Vector<Printer> printers;
  private Handler scanProgressHandler = new Handler()
  {
    public void handleMessage(Message paramAnonymousMessage)
    {
      Button localButton;
      TextView localTextView;
      do
      {
        for (;;)
        {
          try
          {
            localButton = (Button)ActivityLocalPrinters.this.findViewById(2131230806);
            localTextView = (TextView)ActivityLocalPrinters.this.findViewById(2131230804);
            ActivityLocalPrinters.this.last_error = null;
            switch (paramAnonymousMessage.what)
            {
            default: 
              ActivityLocalPrinters.this.adapter.fireOnChanged();
              if (ActivityLocalPrinters.this.last_error != null)
              {
                ActivityLocalPrinters localActivityLocalPrinters = ActivityLocalPrinters.this;
                DialogInterface.OnClickListener local1 = new DialogInterface.OnClickListener()
                {
                  public void onClick(DialogInterface paramAnonymous2DialogInterface, int paramAnonymous2Int) {}
                };
                localActivityLocalPrinters.displayLastError(local1);
              }
              super.handleMessage(paramAnonymousMessage);
              return;
            }
          }
          finally {}
          if (localButton.isEnabled()) {
            ActivityLocalPrinters.this.printers.clear();
          }
          localButton.setEnabled(false);
          if (ActivityLocalPrinters.this.smb_stack.size() < 2) {
            localTextView.setText(ActivityLocalPrinters.this.getResources().getString(2131099754));
          }
        }
      } while (localButton.isEnabled());
      Vector localVector1 = new Vector();
      if (ActivityLocalPrinters.this.st_usb != null) {}
      Vector localVector2;
      Vector localVector9;
      int i4;
      synchronized (ActivityLocalPrinters.this.st_usb.getPrinters())
      {
        localVector1.addAll(???);
        if (ActivityLocalPrinters.this.st_bluetooth != null) {}
        synchronized (ActivityLocalPrinters.this.st_bluetooth.getPrinters())
        {
          localVector1.addAll(???);
          localVector2 = new Vector();
          if (ActivityLocalPrinters.this.st_bonjour == null) {
            break label396;
          }
          localVector9 = ActivityLocalPrinters.this.st_bonjour.getPrinters();
          i4 = 0;
        }
      }
      try
      {
        if (i4 < localVector9.size())
        {
          Printer localPrinter7 = (Printer)localVector9.get(i4);
          if (localPrinter7.id.endsWith("_printershare._tcp.local.")) {
            localVector1.add(localPrinter7);
          }
          for (;;)
          {
            i4++;
            break;
            localObject9 = finally;
            throw localObject9;
            localObject8 = finally;
            throw localObject8;
            localVector2.add(localPrinter7);
          }
        }
      }
      finally {}
      label396:
      if (ActivityLocalPrinters.this.st_bjnp != null) {}
      synchronized (ActivityLocalPrinters.this.st_bjnp.getPrinters())
      {
        localVector2.addAll(???);
        if (ActivityLocalPrinters.this.st_snmp != null) {}
        synchronized (ActivityLocalPrinters.this.st_snmp.getPrinters())
        {
          localVector2.addAll(???);
          if (ActivityLocalPrinters.this.st_wsd != null) {}
          synchronized (ActivityLocalPrinters.this.st_wsd.getPrinters())
          {
            localVector2.addAll(???);
            if (ActivityLocalPrinters.this.st_tpl == null) {}
          }
        }
      }
      Hashtable localHashtable2;
      label784:
      int i3;
      synchronized (ActivityLocalPrinters.this.st_tpl.getPrinters())
      {
        localVector2.addAll(???);
        Hashtable localHashtable1 = new Hashtable();
        localHashtable1.put("_pdl-datastream._tcp.local.", Integer.valueOf(0));
        localHashtable1.put("_canon-bjnp1._tcp.local.", Integer.valueOf(1));
        localHashtable1.put("_wprt._tcp.local.", Integer.valueOf(2));
        localHashtable1.put("_printer._tcp.local.", Integer.valueOf(3));
        localHashtable1.put("_ipp._tcp.local.", Integer.valueOf(4));
        localHashtable2 = new Hashtable();
        for (int i = 0;; i++)
        {
          int j = localVector2.size();
          if (i >= j) {
            break;
          }
          try
          {
            localPrinter5 = (Printer)localVector2.get(i);
            localInteger1 = (Integer)localHashtable1.get(localPrinter5.id.substring(1 + localPrinter5.id.indexOf(".")));
            String str5 = localPrinter5.direct_address;
            String str6 = str5.substring(3 + str5.indexOf("://"));
            int i2 = str6.indexOf(":");
            if (i2 < 0) {
              i2 = str6.indexOf("/");
            }
            if (i2 < 0) {
              i2 = str6.length();
            }
            String str7 = str6.substring(0, i2);
            localVector4 = (Vector)localHashtable2.get(str7);
            if (localVector4 != null) {
              break label1698;
            }
            localVector4 = new Vector();
            localHashtable2.put(str7, localVector4);
          }
          catch (Exception localException)
          {
            Printer localPrinter5;
            Integer localInteger1;
            Vector localVector4;
            Printer localPrinter6;
            Integer localInteger2;
            localException.printStackTrace();
            App.reportThrowable(localException);
            continue;
          }
          if (i3 < localVector4.size())
          {
            localPrinter6 = (Printer)localVector4.get(i3);
            localInteger2 = (Integer)localHashtable1.get(localPrinter6.id.substring(1 + localPrinter6.id.indexOf(".")));
            if ((localInteger2 == null) || (localInteger1 == null) || (localInteger1.intValue() >= localInteger2.intValue())) {
              break label1704;
            }
          }
          localVector4.add(i3, localPrinter5);
        }
        localObject6 = finally;
        throw localObject6;
        localObject5 = finally;
        throw localObject5;
        localObject4 = finally;
        throw localObject4;
      }
      Enumeration localEnumeration = localHashtable2.keys();
      label958:
      label1734:
      label1738:
      for (;;)
      {
        Object localObject2;
        if (localEnumeration.hasMoreElements()) {
          localObject2 = (Vector)localHashtable2.get((String)localEnumeration.nextElement());
        }
        for (;;)
        {
          if (localObject2 == null) {
            break label1738;
          }
          Vector localVector3 = new Vector();
          int k = -1 + ((Vector)localObject2).size();
          label981:
          int m;
          label1022:
          int n;
          label1113:
          String str4;
          if (k >= 0)
          {
            Printer localPrinter1 = (Printer)((Vector)localObject2).get(k);
            String str2 = localPrinter1.direct_address.substring(0, localPrinter1.direct_address.indexOf("://"));
            m = 0;
            if (m < k)
            {
              Printer localPrinter2 = (Printer)((Vector)localObject2).get(m);
              String str3 = localPrinter2.direct_address.substring(0, localPrinter2.direct_address.indexOf("://"));
              if ((localPrinter2.direct_address.equals(localPrinter1.direct_address)) || (!str3.equals(str2))) {
                break label1716;
              }
              localVector3.add(0, ((Vector)localObject2).remove(k));
            }
          }
          else
          {
            n = -1 + localVector3.size();
            if (n >= 0)
            {
              Printer localPrinter3 = (Printer)localVector3.get(n);
              str4 = localPrinter3.id.substring(0, localPrinter3.id.indexOf("."));
            }
          }
          for (int i1 = 0;; i1++)
          {
            if (i1 < ((Vector)localObject2).size())
            {
              if (!((Printer)((Vector)localObject2).get(i1)).id.startsWith(str4)) {
                continue;
              }
              ((Vector)localObject2).add(localVector3.remove(n));
              break label1722;
              Printer localPrinter4 = (Printer)((Vector)localObject2).remove(0);
              if (((Vector)localObject2).size() > 0) {
                localPrinter4.otherServices = ((Vector)localObject2);
              }
              localVector1.add(localPrinter4);
              if (localVector3.size() <= 0) {
                break label1734;
              }
              localObject2 = localVector3;
              break label958;
              ActivityLocalPrinters.this.printers.clear();
              ActivityLocalPrinters.this.printers.addAll(localVector1);
              break;
              ActivityLocalPrinters.this.last_error = paramAnonymousMessage.getData().getString("message");
              AlertDialog.Builder localBuilder;
              if (paramAnonymousMessage.arg1 == 0)
              {
                ActivityLocalPrinters.access$2202(ActivityLocalPrinters.this, false);
                if ((ActivityLocalPrinters.this.stf_bonjour) || (ActivityLocalPrinters.this.stf_snmp) || (ActivityLocalPrinters.this.stf_bjnp) || (ActivityLocalPrinters.this.stf_wsd) || (ActivityLocalPrinters.this.stf_tpl) || (ActivityLocalPrinters.this.stf_bluetooth) || (ActivityLocalPrinters.this.stf_usb)) {
                  break label1661;
                }
                localButton.setEnabled(true);
                if (ActivityLocalPrinters.this.smb_stack.size() < 2)
                {
                  String str1 = ActivityLocalPrinters.this.getResources().getString(2131099753);
                  Object[] arrayOfObject = new Object[1];
                  arrayOfObject[0] = Integer.valueOf(ActivityLocalPrinters.this.printers.size());
                  localTextView.setText(String.format(str1, arrayOfObject));
                }
                if ((ActivityLocalPrinters.this.last_error != null) || (ActivityLocalPrinters.this.printers.size() != 0) || (ActivityLocalPrinters.this.isFinishing())) {
                  break;
                }
                localBuilder = new AlertDialog.Builder(ActivityLocalPrinters.this).setIcon(17301659).setTitle(2131099846).setNeutralButton(2131099703, null);
                if (ActivityLocalPrinters.this.scan_type != 2) {
                  break label1663;
                }
                localBuilder.setMessage(2131099849);
              }
              for (;;)
              {
                localBuilder.show();
                break;
                if (paramAnonymousMessage.arg1 == 1)
                {
                  ActivityLocalPrinters.access$2302(ActivityLocalPrinters.this, false);
                  break label1309;
                }
                if (paramAnonymousMessage.arg1 == 2)
                {
                  ActivityLocalPrinters.access$2402(ActivityLocalPrinters.this, false);
                  break label1309;
                }
                if (paramAnonymousMessage.arg1 == 3)
                {
                  ActivityLocalPrinters.access$2502(ActivityLocalPrinters.this, false);
                  break label1309;
                }
                if (paramAnonymousMessage.arg1 == 4)
                {
                  ActivityLocalPrinters.access$2602(ActivityLocalPrinters.this, false);
                  break label1309;
                }
                if (paramAnonymousMessage.arg1 == 5)
                {
                  ActivityLocalPrinters.access$2702(ActivityLocalPrinters.this, false);
                  break label1309;
                }
                if (paramAnonymousMessage.arg1 != 6) {
                  break label1309;
                }
                ActivityLocalPrinters.access$2802(ActivityLocalPrinters.this, false);
                break label1309;
                label1661:
                break;
                label1663:
                if (ActivityLocalPrinters.this.scan_type == 1) {
                  localBuilder.setMessage(2131099848);
                } else {
                  localBuilder.setMessage(2131099847);
                }
              }
              i3 = 0;
              break label784;
              i3++;
              break label784;
              k--;
              break label981;
              m++;
              break label1022;
            }
            n--;
            break label1113;
          }
          localObject2 = null;
        }
      }
    }
  };
  private int scan_type;
  private Vector<SmbFile> smb_files;
  private Vector<Printer> smb_printers;
  private Stack<SmbFile> smb_stack;
  private ScanThreadBJNP st_bjnp;
  private ScanThreadBluetooth st_bluetooth;
  private ScanThreadBonjour st_bonjour;
  private Thread st_smb;
  private ScanThreadSNMP st_snmp;
  private ScanThreadTPL st_tpl;
  private ScanThreadUSB st_usb;
  private ScanThreadWSD st_wsd;
  private boolean stf_bjnp;
  private boolean stf_bluetooth;
  private boolean stf_bonjour;
  private boolean stf_snmp;
  private boolean stf_tpl;
  private boolean stf_usb;
  private boolean stf_wsd;
  private View view_dialog_authorization;
  private PowerManager.WakeLock wl;
  private Thread wt;
  
  private void proceedSmb(SmbFile paramSmbFile)
  {
    TextView localTextView;
    String str1;
    int i;
    label64:
    StringBuilder localStringBuilder;
    if (paramSmbFile == null)
    {
      ((SmbFile)this.smb_stack.pop());
      this.smb_printers.clear();
      this.smb_files.clear();
      this.adapter.fireOnChanged();
      if (this.smb_stack.size() <= 1) {
        break label226;
      }
      localTextView = (TextView)findViewById(2131230804);
      str1 = "";
      i = 1;
      if (i >= this.smb_stack.size()) {
        break label176;
      }
      localStringBuilder = new StringBuilder().append(str1);
      if (i <= 1) {
        break label169;
      }
    }
    label169:
    for (String str2 = " | ";; str2 = "")
    {
      str1 = str2 + ((SmbFile)this.smb_stack.get(i)).getServer();
      i++;
      break label64;
      if ((this.smb_stack.size() != 0) && (paramSmbFile == this.smb_stack.lastElement())) {
        break;
      }
      this.smb_stack.add(paramSmbFile);
      break;
    }
    label176:
    localTextView.setText(str1 + " - " + getResources().getString(2131099754));
    showProgress(getResources().getString(2131099746));
    label226:
    this.st_smb = new Thread()
    {
      /* Error */
      public void run()
      {
        // Byte code:
        //   0: aload_0
        //   1: getfield 15	com/dynamixsoftware/printershare/ActivityLocalPrinters$6:this$0	Lcom/dynamixsoftware/printershare/ActivityLocalPrinters;
        //   4: invokestatic 27	com/dynamixsoftware/printershare/ActivityLocalPrinters:access$300	(Lcom/dynamixsoftware/printershare/ActivityLocalPrinters;)Ljava/util/Stack;
        //   7: invokevirtual 33	java/util/Stack:lastElement	()Ljava/lang/Object;
        //   10: checkcast 35	com/dynamixsoftware/printershare/smb/SmbFile
        //   13: astore_1
        //   14: iconst_m1
        //   15: istore_2
        //   16: aload_1
        //   17: invokevirtual 39	com/dynamixsoftware/printershare/smb/SmbFile:getType	()I
        //   20: istore_2
        //   21: aload_1
        //   22: invokevirtual 43	com/dynamixsoftware/printershare/smb/SmbFile:listFiles	()[Lcom/dynamixsoftware/printershare/smb/SmbFile;
        //   25: astore 21
        //   27: iconst_0
        //   28: istore 22
        //   30: iload 22
        //   32: aload 21
        //   34: arraylength
        //   35: if_icmpge +44 -> 79
        //   38: aload 21
        //   40: iload 22
        //   42: aaload
        //   43: astore 23
        //   45: aload 23
        //   47: invokevirtual 39	com/dynamixsoftware/printershare/smb/SmbFile:getType	()I
        //   50: istore 24
        //   52: iload 24
        //   54: iconst_2
        //   55: if_icmpeq +9 -> 64
        //   58: iload 24
        //   60: iconst_4
        //   61: if_icmpne +99 -> 160
        //   64: aload_0
        //   65: getfield 15	com/dynamixsoftware/printershare/ActivityLocalPrinters$6:this$0	Lcom/dynamixsoftware/printershare/ActivityLocalPrinters;
        //   68: invokestatic 47	com/dynamixsoftware/printershare/ActivityLocalPrinters:access$400	(Lcom/dynamixsoftware/printershare/ActivityLocalPrinters;)Ljava/lang/Thread;
        //   71: astore 25
        //   73: aload 25
        //   75: aload_0
        //   76: if_acmpeq +59 -> 135
        //   79: aload_0
        //   80: getfield 15	com/dynamixsoftware/printershare/ActivityLocalPrinters$6:this$0	Lcom/dynamixsoftware/printershare/ActivityLocalPrinters;
        //   83: invokestatic 47	com/dynamixsoftware/printershare/ActivityLocalPrinters:access$400	(Lcom/dynamixsoftware/printershare/ActivityLocalPrinters;)Ljava/lang/Thread;
        //   86: aload_0
        //   87: if_acmpne +38 -> 125
        //   90: aload_0
        //   91: invokevirtual 51	com/dynamixsoftware/printershare/ActivityLocalPrinters$6:isAlive	()Z
        //   94: ifeq +31 -> 125
        //   97: iload_2
        //   98: istore 5
        //   100: aload_0
        //   101: getfield 15	com/dynamixsoftware/printershare/ActivityLocalPrinters$6:this$0	Lcom/dynamixsoftware/printershare/ActivityLocalPrinters;
        //   104: astore 6
        //   106: new 53	com/dynamixsoftware/printershare/ActivityLocalPrinters$6$4
        //   109: dup
        //   110: aload_0
        //   111: iload 5
        //   113: invokespecial 56	com/dynamixsoftware/printershare/ActivityLocalPrinters$6$4:<init>	(Lcom/dynamixsoftware/printershare/ActivityLocalPrinters$6;I)V
        //   116: astore 7
        //   118: aload 6
        //   120: aload 7
        //   122: invokevirtual 60	com/dynamixsoftware/printershare/ActivityLocalPrinters:runOnUiThread	(Ljava/lang/Runnable;)V
        //   125: aload_0
        //   126: getfield 15	com/dynamixsoftware/printershare/ActivityLocalPrinters$6:this$0	Lcom/dynamixsoftware/printershare/ActivityLocalPrinters;
        //   129: aconst_null
        //   130: invokestatic 64	com/dynamixsoftware/printershare/ActivityLocalPrinters:access$402	(Lcom/dynamixsoftware/printershare/ActivityLocalPrinters;Ljava/lang/Thread;)Ljava/lang/Thread;
        //   133: pop
        //   134: return
        //   135: aload_0
        //   136: getfield 15	com/dynamixsoftware/printershare/ActivityLocalPrinters$6:this$0	Lcom/dynamixsoftware/printershare/ActivityLocalPrinters;
        //   139: astore 26
        //   141: new 66	com/dynamixsoftware/printershare/ActivityLocalPrinters$6$1
        //   144: dup
        //   145: aload_0
        //   146: aload 23
        //   148: invokespecial 69	com/dynamixsoftware/printershare/ActivityLocalPrinters$6$1:<init>	(Lcom/dynamixsoftware/printershare/ActivityLocalPrinters$6;Lcom/dynamixsoftware/printershare/smb/SmbFile;)V
        //   151: astore 27
        //   153: aload 26
        //   155: aload 27
        //   157: invokevirtual 60	com/dynamixsoftware/printershare/ActivityLocalPrinters:runOnUiThread	(Ljava/lang/Runnable;)V
        //   160: iload 24
        //   162: bipush 32
        //   164: if_icmpne +358 -> 522
        //   167: aload 21
        //   169: iload 22
        //   171: aaload
        //   172: invokevirtual 73	com/dynamixsoftware/printershare/smb/SmbFile:printerGetInfo	()[Ljava/lang/String;
        //   175: astore 41
        //   177: aload 41
        //   179: astore 29
        //   181: new 75	com/dynamixsoftware/printershare/data/Printer
        //   184: dup
        //   185: invokespecial 76	com/dynamixsoftware/printershare/data/Printer:<init>	()V
        //   188: astore 30
        //   190: aload 30
        //   192: new 78	com/dynamixsoftware/printershare/data/User
        //   195: dup
        //   196: invokespecial 79	com/dynamixsoftware/printershare/data/User:<init>	()V
        //   199: putfield 83	com/dynamixsoftware/printershare/data/Printer:owner	Lcom/dynamixsoftware/printershare/data/User;
        //   202: aload 30
        //   204: new 85	java/util/Hashtable
        //   207: dup
        //   208: invokespecial 86	java/util/Hashtable:<init>	()V
        //   211: putfield 90	com/dynamixsoftware/printershare/data/Printer:capabilities	Ljava/util/Hashtable;
        //   214: aload 30
        //   216: iconst_1
        //   217: putfield 94	com/dynamixsoftware/printershare/data/Printer:online	Z
        //   220: aload 21
        //   222: iload 22
        //   224: aaload
        //   225: invokevirtual 98	com/dynamixsoftware/printershare/smb/SmbFile:getName	()Ljava/lang/String;
        //   228: astore 32
        //   230: aload 32
        //   232: ldc 100
        //   234: invokevirtual 106	java/lang/String:endsWith	(Ljava/lang/String;)Z
        //   237: ifeq +18 -> 255
        //   240: aload 32
        //   242: iconst_0
        //   243: iconst_m1
        //   244: aload 32
        //   246: invokevirtual 109	java/lang/String:length	()I
        //   249: iadd
        //   250: invokevirtual 113	java/lang/String:substring	(II)Ljava/lang/String;
        //   253: astore 32
        //   255: aload 21
        //   257: iload 22
        //   259: aaload
        //   260: invokevirtual 116	com/dynamixsoftware/printershare/smb/SmbFile:getPath	()Ljava/lang/String;
        //   263: astore 33
        //   265: aload 30
        //   267: aload 33
        //   269: putfield 120	com/dynamixsoftware/printershare/data/Printer:id	Ljava/lang/String;
        //   272: aload 30
        //   274: aload 32
        //   276: putfield 123	com/dynamixsoftware/printershare/data/Printer:title	Ljava/lang/String;
        //   279: ldc 125
        //   281: astore 34
        //   283: aload_1
        //   284: invokevirtual 129	com/dynamixsoftware/printershare/smb/SmbFile:getPrincipal	()Ljava/security/Principal;
        //   287: checkcast 131	com/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication
        //   290: astore 35
        //   292: aload 35
        //   294: invokevirtual 134	com/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication:getDomain	()Ljava/lang/String;
        //   297: astore 36
        //   299: aload 36
        //   301: ifnull +30 -> 331
        //   304: new 136	java/lang/StringBuilder
        //   307: dup
        //   308: invokespecial 137	java/lang/StringBuilder:<init>	()V
        //   311: aload 34
        //   313: invokevirtual 141	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
        //   316: aload 36
        //   318: invokevirtual 141	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
        //   321: ldc 143
        //   323: invokevirtual 141	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
        //   326: invokevirtual 146	java/lang/StringBuilder:toString	()Ljava/lang/String;
        //   329: astore 34
        //   331: aload 35
        //   333: invokevirtual 149	com/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication:getUsername	()Ljava/lang/String;
        //   336: astore 37
        //   338: aload 37
        //   340: ifnull +25 -> 365
        //   343: new 136	java/lang/StringBuilder
        //   346: dup
        //   347: invokespecial 137	java/lang/StringBuilder:<init>	()V
        //   350: aload 34
        //   352: invokevirtual 141	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
        //   355: aload 37
        //   357: invokevirtual 141	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
        //   360: invokevirtual 146	java/lang/StringBuilder:toString	()Ljava/lang/String;
        //   363: astore 34
        //   365: aload 35
        //   367: invokevirtual 152	com/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication:getPassword	()Ljava/lang/String;
        //   370: astore 38
        //   372: aload 38
        //   374: ifnull +30 -> 404
        //   377: new 136	java/lang/StringBuilder
        //   380: dup
        //   381: invokespecial 137	java/lang/StringBuilder:<init>	()V
        //   384: aload 34
        //   386: invokevirtual 141	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
        //   389: ldc 154
        //   391: invokevirtual 141	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
        //   394: aload 38
        //   396: invokevirtual 141	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
        //   399: invokevirtual 146	java/lang/StringBuilder:toString	()Ljava/lang/String;
        //   402: astore 34
        //   404: aload 30
        //   406: new 136	java/lang/StringBuilder
        //   409: dup
        //   410: invokespecial 137	java/lang/StringBuilder:<init>	()V
        //   413: ldc 156
        //   415: invokevirtual 141	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
        //   418: aload 34
        //   420: invokestatic 162	java/net/URLEncoder:encode	(Ljava/lang/String;)Ljava/lang/String;
        //   423: invokevirtual 141	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
        //   426: ldc 164
        //   428: invokevirtual 141	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
        //   431: aload 33
        //   433: bipush 6
        //   435: invokevirtual 167	java/lang/String:substring	(I)Ljava/lang/String;
        //   438: invokevirtual 141	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
        //   441: invokevirtual 146	java/lang/StringBuilder:toString	()Ljava/lang/String;
        //   444: putfield 170	com/dynamixsoftware/printershare/data/Printer:direct_address	Ljava/lang/String;
        //   447: aload 30
        //   449: getfield 83	com/dynamixsoftware/printershare/data/Printer:owner	Lcom/dynamixsoftware/printershare/data/User;
        //   452: aload 21
        //   454: iload 22
        //   456: aaload
        //   457: invokevirtual 173	com/dynamixsoftware/printershare/smb/SmbFile:getServer	()Ljava/lang/String;
        //   460: putfield 176	com/dynamixsoftware/printershare/data/User:name	Ljava/lang/String;
        //   463: aload 29
        //   465: ifnull +110 -> 575
        //   468: aload 30
        //   470: aload 29
        //   472: iconst_1
        //   473: aaload
        //   474: putfield 179	com/dynamixsoftware/printershare/data/Printer:model	Ljava/lang/String;
        //   477: aload 30
        //   479: aload 29
        //   481: iconst_2
        //   482: aaload
        //   483: putfield 182	com/dynamixsoftware/printershare/data/Printer:location	Ljava/lang/String;
        //   486: aload_0
        //   487: getfield 15	com/dynamixsoftware/printershare/ActivityLocalPrinters$6:this$0	Lcom/dynamixsoftware/printershare/ActivityLocalPrinters;
        //   490: invokestatic 47	com/dynamixsoftware/printershare/ActivityLocalPrinters:access$400	(Lcom/dynamixsoftware/printershare/ActivityLocalPrinters;)Ljava/lang/Thread;
        //   493: aload_0
        //   494: if_acmpne -415 -> 79
        //   497: aload_0
        //   498: getfield 15	com/dynamixsoftware/printershare/ActivityLocalPrinters$6:this$0	Lcom/dynamixsoftware/printershare/ActivityLocalPrinters;
        //   501: astore 39
        //   503: new 184	com/dynamixsoftware/printershare/ActivityLocalPrinters$6$2
        //   506: dup
        //   507: aload_0
        //   508: aload 30
        //   510: invokespecial 187	com/dynamixsoftware/printershare/ActivityLocalPrinters$6$2:<init>	(Lcom/dynamixsoftware/printershare/ActivityLocalPrinters$6;Lcom/dynamixsoftware/printershare/data/Printer;)V
        //   513: astore 40
        //   515: aload 39
        //   517: aload 40
        //   519: invokevirtual 60	com/dynamixsoftware/printershare/ActivityLocalPrinters:runOnUiThread	(Ljava/lang/Runnable;)V
        //   522: iinc 22 1
        //   525: goto -495 -> 30
        //   528: astore 28
        //   530: aload 28
        //   532: invokevirtual 190	java/lang/Exception:printStackTrace	()V
        //   535: aload 28
        //   537: invokestatic 196	com/dynamixsoftware/printershare/App:reportThrowable	(Ljava/lang/Throwable;)V
        //   540: aconst_null
        //   541: astore 29
        //   543: goto -362 -> 181
        //   546: astore 8
        //   548: aload_1
        //   549: invokevirtual 129	com/dynamixsoftware/printershare/smb/SmbFile:getPrincipal	()Ljava/security/Principal;
        //   552: checkcast 131	com/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication
        //   555: astore 9
        //   557: aload 9
        //   559: getstatic 200	com/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication:ANONYMOUS	Lcom/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication;
        //   562: if_acmpne +50 -> 612
        //   565: aload_1
        //   566: getstatic 203	com/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication:DEFAULT	Lcom/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication;
        //   569: invokevirtual 207	com/dynamixsoftware/printershare/smb/SmbFile:setAuth	(Lcom/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication;)V
        //   572: goto -556 -> 16
        //   575: aload 30
        //   577: aload 32
        //   579: putfield 179	com/dynamixsoftware/printershare/data/Printer:model	Ljava/lang/String;
        //   582: goto -96 -> 486
        //   585: astore 31
        //   587: aload 31
        //   589: invokevirtual 190	java/lang/Exception:printStackTrace	()V
        //   592: aload 31
        //   594: invokestatic 196	com/dynamixsoftware/printershare/App:reportThrowable	(Ljava/lang/Throwable;)V
        //   597: goto -75 -> 522
        //   600: astore_3
        //   601: aload_3
        //   602: invokevirtual 190	java/lang/Exception:printStackTrace	()V
        //   605: aload_3
        //   606: invokestatic 196	com/dynamixsoftware/printershare/App:reportThrowable	(Ljava/lang/Throwable;)V
        //   609: goto -530 -> 79
        //   612: aload 9
        //   614: getstatic 203	com/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication:DEFAULT	Lcom/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication;
        //   617: if_acmpne +51 -> 668
        //   620: new 131	com/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication
        //   623: dup
        //   624: aload_0
        //   625: getfield 15	com/dynamixsoftware/printershare/ActivityLocalPrinters$6:this$0	Lcom/dynamixsoftware/printershare/ActivityLocalPrinters;
        //   628: getfield 211	com/dynamixsoftware/printershare/ActivityLocalPrinters:prefs	Landroid/content/SharedPreferences;
        //   631: ldc 213
        //   633: aconst_null
        //   634: invokeinterface 219 3 0
        //   639: invokespecial 222	com/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication:<init>	(Ljava/lang/String;)V
        //   642: astore 10
        //   644: aload 10
        //   646: ifnull +22 -> 668
        //   649: aload 9
        //   651: aload 10
        //   653: invokevirtual 226	com/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication:equals	(Ljava/lang/Object;)Z
        //   656: ifne +12 -> 668
        //   659: aload_1
        //   660: aload 10
        //   662: invokevirtual 207	com/dynamixsoftware/printershare/smb/SmbFile:setAuth	(Lcom/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication;)V
        //   665: goto -649 -> 16
        //   668: aload_0
        //   669: getfield 15	com/dynamixsoftware/printershare/ActivityLocalPrinters$6:this$0	Lcom/dynamixsoftware/printershare/ActivityLocalPrinters;
        //   672: invokestatic 27	com/dynamixsoftware/printershare/ActivityLocalPrinters:access$300	(Lcom/dynamixsoftware/printershare/ActivityLocalPrinters;)Ljava/util/Stack;
        //   675: invokevirtual 229	java/util/Stack:size	()I
        //   678: istore 11
        //   680: aconst_null
        //   681: astore 12
        //   683: iload 11
        //   685: iconst_1
        //   686: if_icmple +22 -> 708
        //   689: aload_0
        //   690: getfield 15	com/dynamixsoftware/printershare/ActivityLocalPrinters$6:this$0	Lcom/dynamixsoftware/printershare/ActivityLocalPrinters;
        //   693: invokestatic 27	com/dynamixsoftware/printershare/ActivityLocalPrinters:access$300	(Lcom/dynamixsoftware/printershare/ActivityLocalPrinters;)Ljava/util/Stack;
        //   696: iconst_1
        //   697: invokevirtual 233	java/util/Stack:get	(I)Ljava/lang/Object;
        //   700: checkcast 35	com/dynamixsoftware/printershare/smb/SmbFile
        //   703: invokevirtual 173	com/dynamixsoftware/printershare/smb/SmbFile:getServer	()Ljava/lang/String;
        //   706: astore 12
        //   708: aload_0
        //   709: getfield 15	com/dynamixsoftware/printershare/ActivityLocalPrinters$6:this$0	Lcom/dynamixsoftware/printershare/ActivityLocalPrinters;
        //   712: invokestatic 27	com/dynamixsoftware/printershare/ActivityLocalPrinters:access$300	(Lcom/dynamixsoftware/printershare/ActivityLocalPrinters;)Ljava/util/Stack;
        //   715: invokevirtual 229	java/util/Stack:size	()I
        //   718: istore 13
        //   720: aconst_null
        //   721: astore 14
        //   723: iload 13
        //   725: iconst_2
        //   726: if_icmple +21 -> 747
        //   729: aload_0
        //   730: getfield 15	com/dynamixsoftware/printershare/ActivityLocalPrinters$6:this$0	Lcom/dynamixsoftware/printershare/ActivityLocalPrinters;
        //   733: invokestatic 27	com/dynamixsoftware/printershare/ActivityLocalPrinters:access$300	(Lcom/dynamixsoftware/printershare/ActivityLocalPrinters;)Ljava/util/Stack;
        //   736: invokevirtual 33	java/util/Stack:lastElement	()Ljava/lang/Object;
        //   739: checkcast 35	com/dynamixsoftware/printershare/smb/SmbFile
        //   742: invokevirtual 173	com/dynamixsoftware/printershare/smb/SmbFile:getServer	()Ljava/lang/String;
        //   745: astore 14
        //   747: aload 12
        //   749: ifnull +59 -> 808
        //   752: aload 9
        //   754: invokevirtual 134	com/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication:getDomain	()Ljava/lang/String;
        //   757: aload 12
        //   759: invokevirtual 234	java/lang/String:equals	(Ljava/lang/Object;)Z
        //   762: ifne +46 -> 808
        //   765: aload 9
        //   767: invokevirtual 134	com/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication:getDomain	()Ljava/lang/String;
        //   770: aload 14
        //   772: invokevirtual 234	java/lang/String:equals	(Ljava/lang/Object;)Z
        //   775: ifne +33 -> 808
        //   778: new 131	com/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication
        //   781: dup
        //   782: aload 12
        //   784: aload 9
        //   786: invokevirtual 149	com/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication:getUsername	()Ljava/lang/String;
        //   789: aload 9
        //   791: invokevirtual 152	com/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication:getPassword	()Ljava/lang/String;
        //   794: invokespecial 237	com/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication:<init>	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
        //   797: astore 20
        //   799: aload_1
        //   800: aload 20
        //   802: invokevirtual 207	com/dynamixsoftware/printershare/smb/SmbFile:setAuth	(Lcom/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication;)V
        //   805: goto -789 -> 16
        //   808: aload 14
        //   810: ifnull +54 -> 864
        //   813: aload 9
        //   815: invokevirtual 134	com/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication:getDomain	()Ljava/lang/String;
        //   818: aload 14
        //   820: invokevirtual 234	java/lang/String:equals	(Ljava/lang/Object;)Z
        //   823: ifne +41 -> 864
        //   826: aload 9
        //   828: invokevirtual 149	com/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication:getUsername	()Ljava/lang/String;
        //   831: astore 17
        //   833: aload 9
        //   835: invokevirtual 152	com/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication:getPassword	()Ljava/lang/String;
        //   838: astore 18
        //   840: new 131	com/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication
        //   843: dup
        //   844: aload 14
        //   846: aload 17
        //   848: aload 18
        //   850: invokespecial 237	com/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication:<init>	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
        //   853: astore 19
        //   855: aload_1
        //   856: aload 19
        //   858: invokevirtual 207	com/dynamixsoftware/printershare/smb/SmbFile:setAuth	(Lcom/dynamixsoftware/printershare/smb/NtlmPasswordAuthentication;)V
        //   861: goto -845 -> 16
        //   864: aload_0
        //   865: getfield 15	com/dynamixsoftware/printershare/ActivityLocalPrinters$6:this$0	Lcom/dynamixsoftware/printershare/ActivityLocalPrinters;
        //   868: astore 15
        //   870: new 239	com/dynamixsoftware/printershare/ActivityLocalPrinters$6$3
        //   873: dup
        //   874: aload_0
        //   875: aload_1
        //   876: invokespecial 240	com/dynamixsoftware/printershare/ActivityLocalPrinters$6$3:<init>	(Lcom/dynamixsoftware/printershare/ActivityLocalPrinters$6;Lcom/dynamixsoftware/printershare/smb/SmbFile;)V
        //   879: astore 16
        //   881: aload 15
        //   883: aload 16
        //   885: invokevirtual 60	com/dynamixsoftware/printershare/ActivityLocalPrinters:runOnUiThread	(Ljava/lang/Runnable;)V
        //   888: goto -809 -> 79
        // Local variable table:
        //   start	length	slot	name	signature
        //   0	891	0	this	6
        //   13	863	1	localSmbFile1	SmbFile
        //   15	83	2	i	int
        //   600	6	3	localException1	Exception
        //   98	14	5	j	int
        //   104	15	6	localActivityLocalPrinters1	ActivityLocalPrinters
        //   116	5	7	local4	4
        //   546	1	8	localSmbAuthException	SmbAuthException
        //   555	279	9	localNtlmPasswordAuthentication1	NtlmPasswordAuthentication
        //   642	19	10	localNtlmPasswordAuthentication2	NtlmPasswordAuthentication
        //   678	9	11	k	int
        //   681	102	12	str1	String
        //   718	9	13	m	int
        //   721	124	14	str2	String
        //   868	14	15	localActivityLocalPrinters2	ActivityLocalPrinters
        //   879	5	16	local3	3
        //   831	16	17	str3	String
        //   838	11	18	str4	String
        //   853	4	19	localNtlmPasswordAuthentication3	NtlmPasswordAuthentication
        //   797	4	20	localNtlmPasswordAuthentication4	NtlmPasswordAuthentication
        //   25	428	21	arrayOfSmbFile	SmbFile[]
        //   28	495	22	n	int
        //   43	104	23	localSmbFile2	SmbFile
        //   50	115	24	i1	int
        //   71	3	25	localThread	Thread
        //   139	15	26	localActivityLocalPrinters3	ActivityLocalPrinters
        //   151	5	27	local1	1
        //   528	8	28	localException2	Exception
        //   179	363	29	arrayOfString1	String[]
        //   188	388	30	localPrinter	Printer
        //   585	8	31	localException3	Exception
        //   228	350	32	str5	String
        //   263	169	33	str6	String
        //   281	138	34	str7	String
        //   290	76	35	localNtlmPasswordAuthentication5	NtlmPasswordAuthentication
        //   297	20	36	str8	String
        //   336	20	37	str9	String
        //   370	25	38	str10	String
        //   501	15	39	localActivityLocalPrinters4	ActivityLocalPrinters
        //   513	5	40	local2	2
        //   175	3	41	arrayOfString2	String[]
        // Exception table:
        //   from	to	target	type
        //   167	177	528	java/lang/Exception
        //   16	27	546	com/dynamixsoftware/printershare/smb/SmbAuthException
        //   30	52	546	com/dynamixsoftware/printershare/smb/SmbAuthException
        //   64	73	546	com/dynamixsoftware/printershare/smb/SmbAuthException
        //   135	160	546	com/dynamixsoftware/printershare/smb/SmbAuthException
        //   167	177	546	com/dynamixsoftware/printershare/smb/SmbAuthException
        //   181	255	546	com/dynamixsoftware/printershare/smb/SmbAuthException
        //   255	279	546	com/dynamixsoftware/printershare/smb/SmbAuthException
        //   283	299	546	com/dynamixsoftware/printershare/smb/SmbAuthException
        //   304	331	546	com/dynamixsoftware/printershare/smb/SmbAuthException
        //   331	338	546	com/dynamixsoftware/printershare/smb/SmbAuthException
        //   343	365	546	com/dynamixsoftware/printershare/smb/SmbAuthException
        //   365	372	546	com/dynamixsoftware/printershare/smb/SmbAuthException
        //   377	404	546	com/dynamixsoftware/printershare/smb/SmbAuthException
        //   404	463	546	com/dynamixsoftware/printershare/smb/SmbAuthException
        //   468	486	546	com/dynamixsoftware/printershare/smb/SmbAuthException
        //   486	522	546	com/dynamixsoftware/printershare/smb/SmbAuthException
        //   530	540	546	com/dynamixsoftware/printershare/smb/SmbAuthException
        //   575	582	546	com/dynamixsoftware/printershare/smb/SmbAuthException
        //   587	597	546	com/dynamixsoftware/printershare/smb/SmbAuthException
        //   181	255	585	java/lang/Exception
        //   255	279	585	java/lang/Exception
        //   283	299	585	java/lang/Exception
        //   304	331	585	java/lang/Exception
        //   331	338	585	java/lang/Exception
        //   343	365	585	java/lang/Exception
        //   365	372	585	java/lang/Exception
        //   377	404	585	java/lang/Exception
        //   404	463	585	java/lang/Exception
        //   468	486	585	java/lang/Exception
        //   486	522	585	java/lang/Exception
        //   575	582	585	java/lang/Exception
        //   16	27	600	java/lang/Exception
        //   30	52	600	java/lang/Exception
        //   64	73	600	java/lang/Exception
        //   135	160	600	java/lang/Exception
        //   530	540	600	java/lang/Exception
        //   587	597	600	java/lang/Exception
      }
    };
    this.st_smb.start();
  }
  
  private void start_scan()
  {
    if (this.scan_type == 2)
    {
      this.stf_usb = true;
      this.st_usb = new ScanThreadUSB(getApplicationContext(), 15000, null, this.scanProgressHandler);
      this.st_usb.start();
      return;
    }
    if (this.scan_type == 1)
    {
      this.stf_bluetooth = true;
      this.st_bluetooth = new ScanThreadBluetooth(getApplicationContext(), 15000, null, this.scanProgressHandler);
      this.st_bluetooth.start();
      return;
    }
    try
    {
      this.smb_stack.clear();
      proceedSmb(new SmbFile("smb://", NtlmPasswordAuthentication.ANONYMOUS));
      this.stf_bonjour = true;
      this.st_bonjour = new ScanThreadBonjour(getApplicationContext(), 15000, null, this.scanProgressHandler);
      this.st_bonjour.start();
      this.stf_snmp = true;
      this.st_snmp = new ScanThreadSNMP(getApplicationContext(), 15000, null, this.scanProgressHandler);
      this.st_snmp.start();
      this.stf_bjnp = true;
      this.st_bjnp = new ScanThreadBJNP(getApplicationContext(), 15000, null, this.scanProgressHandler);
      this.st_bjnp.start();
      this.stf_wsd = true;
      this.st_wsd = new ScanThreadWSD(getApplicationContext(), 15000, null, this.scanProgressHandler);
      this.st_wsd.start();
      this.stf_tpl = true;
      this.st_tpl = new ScanThreadTPL(getApplicationContext(), 15000, null, this.scanProgressHandler);
      this.st_tpl.start();
      return;
    }
    catch (Exception localException)
    {
      for (;;)
      {
        localException.printStackTrace();
        App.reportThrowable(localException);
      }
    }
  }
  
  protected void init()
  {
    if (token == null) {
      super.init();
    }
  }
  
  protected void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
  {
    super.onActivityResult(paramInt1, paramInt2, paramIntent);
    if (paramInt1 == 10)
    {
      if (paramInt2 != -1) {
        break label74;
      }
      String str = paramIntent.getExtras().getString("model");
      xprn.model = str;
      xprn.drv_manual = true;
      this.wt = new SetupPrinterThread(xprn, true, false);
      this.wt.start();
    }
    for (;;)
    {
      xprn = null;
      return;
      label74:
      hideProgress();
    }
  }
  
  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903066);
    setTitle(2131099672);
    try
    {
      this.wl = ((PowerManager)getSystemService("power")).newWakeLock(6, "PrinterShare");
      this.wl.acquire();
      str = getIntent().getAction();
      if ("BT".equals(str))
      {
        this.scan_type = 1;
        ((Button)findViewById(2131230806)).setOnClickListener(new View.OnClickListener()
        {
          public void onClick(View paramAnonymousView)
          {
            ActivityLocalPrinters.this.start_scan();
          }
        });
        if (this.scan_type == 0)
        {
          this.view_dialog_authorization = LayoutInflater.from(this).inflate(2130903045, null);
          this.dialog_authorization = new AlertDialog.Builder(this).setIcon(17301543).setTitle(2131099841).setView(this.view_dialog_authorization).setPositiveButton(2131099703, new DialogInterface.OnClickListener()
          {
            public void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt) {}
          }).setNegativeButton(2131099707, new DialogInterface.OnClickListener()
          {
            public void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt) {}
          }).create();
        }
        this.smb_stack = new Stack();
        this.smb_files = new Vector();
        this.smb_printers = new Vector();
        this.printers = new Vector();
        ListView localListView = (ListView)findViewById(2131230805);
        this.adapter = new PrinterAdapter(this);
        localListView.setAdapter(this.adapter);
        localListView.setOnItemClickListener(new AdapterView.OnItemClickListener()
        {
          public void onItemClick(AdapterView<?> paramAnonymousAdapterView, View paramAnonymousView, int paramAnonymousInt, long paramAnonymousLong)
          {
            Object localObject = paramAnonymousView.getTag();
            if ((localObject != null) && ((localObject instanceof Printer)))
            {
              Printer localPrinter = (Printer)paramAnonymousView.getTag();
              ActivityLocalPrinters.access$102(ActivityLocalPrinters.this, new ActivityLocalPrinters.SetupPrinterThread(ActivityLocalPrinters.this, localPrinter, false, false));
              ActivityLocalPrinters.this.wt.start();
              return;
            }
            ActivityLocalPrinters.this.proceedSmb((SmbFile)localObject);
          }
        });
        localListView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener()
        {
          public boolean onItemLongClick(AdapterView<?> paramAnonymousAdapterView, View paramAnonymousView, int paramAnonymousInt, long paramAnonymousLong)
          {
            Object localObject = paramAnonymousView.getTag();
            if ((localObject != null) && ((localObject instanceof Printer)))
            {
              Printer localPrinter = (Printer)paramAnonymousView.getTag();
              ActivityLocalPrinters.access$102(ActivityLocalPrinters.this, new ActivityLocalPrinters.SetupPrinterThread(ActivityLocalPrinters.this, localPrinter, false, true));
              ActivityLocalPrinters.this.wt.start();
              return true;
            }
            return false;
          }
        });
        start_scan();
        return;
      }
    }
    catch (Exception localException)
    {
      for (;;)
      {
        String str;
        localException.printStackTrace();
        App.reportThrowable(localException);
        continue;
        if ("USB".equals(str)) {
          this.scan_type = 2;
        } else {
          this.scan_type = 0;
        }
      }
    }
  }
  
  public void onDestroy()
  {
    if (this.stf_bluetooth) {
      this.st_bluetooth.destroy();
    }
    if (this.stf_bonjour) {
      this.st_bonjour.destroy();
    }
    if (this.stf_snmp) {
      this.st_snmp.destroy();
    }
    if (this.stf_bjnp) {
      this.st_bjnp.destroy();
    }
    if (this.stf_wsd) {
      this.st_wsd.destroy();
    }
    if (this.stf_tpl) {
      this.st_tpl.destroy();
    }
    if (this.wl != null) {
      this.wl.release();
    }
    super.onDestroy();
  }
  
  public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
  {
    if ((paramInt == 4) && (this.smb_stack.size() > 1))
    {
      proceedSmb(null);
      return true;
    }
    return super.onKeyDown(paramInt, paramKeyEvent);
  }
  
  class AddPrinterThread
    extends Thread
  {
    private Boolean first_check;
    private Printer prn;
    
    public AddPrinterThread(Printer paramPrinter, Boolean paramBoolean)
    {
      this.prn = paramPrinter;
      this.first_check = paramBoolean;
    }
    
    public void run()
    {
      ActivityLocalPrinters.this.last_error = null;
      ActivityLocalPrinters.this.runOnUiThread(new Runnable()
      {
        public void run()
        {
          ActivityLocalPrinters.this.showProgress(ActivityLocalPrinters.this.getResources().getString(2131099746));
        }
      });
      int i;
      if (this.first_check == null) {
        i = 1;
      }
      for (;;)
      {
        if (i == 0)
        {
          if (this.first_check.booleanValue() == true) {
            ActivityLocalPrinters.this.runOnUiThread(new Runnable()
            {
              public void run()
              {
                ActivityLocalPrinters.this.hideProgress();
                if (!ActivityLocalPrinters.this.isFinishing()) {
                  new AlertDialog.Builder(ActivityLocalPrinters.this).setIcon(17301543).setTitle(2131099857).setMessage(2131099858).setPositiveButton(2131099705, new DialogInterface.OnClickListener()
                  {
                    public void onClick(DialogInterface paramAnonymous2DialogInterface, int paramAnonymous2Int)
                    {
                      ActivityLocalPrinters.access$102(ActivityLocalPrinters.this, new ActivityLocalPrinters.InstallDriverThread(ActivityLocalPrinters.this, ActivityLocalPrinters.AddPrinterThread.this.prn));
                      ActivityLocalPrinters.this.wt.start();
                    }
                  }).setNegativeButton(2131099706, new DialogInterface.OnClickListener()
                  {
                    public void onClick(DialogInterface paramAnonymous2DialogInterface, int paramAnonymous2Int) {}
                  }).show();
                }
              }
            });
          }
          for (;;)
          {
            for (;;)
            {
              ActivityLocalPrinters.access$102(ActivityLocalPrinters.this, null);
              return;
              try
              {
                if ((this.prn.direct_address.startsWith("ptp://")) || (this.prn.drv_name.startsWith("internal"))) {
                  break label285;
                }
                boolean bool = ActivityLocalPrinters.this.drvCheck(this.prn);
                i = bool;
              }
              catch (Exception localException)
              {
                localException.printStackTrace();
                App.reportThrowable(localException);
                i = 0;
              }
            }
            break;
            ActivityLocalPrinters.this.last_error = "Cannot install driver pack. An unknown error has occurred.";
            ActivityLocalPrinters.this.runOnUiThread(new Runnable()
            {
              public void run()
              {
                ActivityLocalPrinters.this.hideProgress();
                ActivityLocalPrinters.this.displayLastError(new DialogInterface.OnClickListener()
                {
                  public void onClick(DialogInterface paramAnonymous2DialogInterface, int paramAnonymous2Int) {}
                });
              }
            });
          }
        }
        ActivityLocalPrinters.this.setPrinter(this.prn);
        int j;
        SharedPreferences.Editor localEditor;
        if (this.prn.id.startsWith("smb://"))
        {
          j = this.prn.direct_address.indexOf("@");
          localEditor = ActivityLocalPrinters.this.prefs.edit();
          if (j >= 0) {
            break label266;
          }
        }
        label266:
        for (String str = "";; str = this.prn.direct_address.substring(6, j))
        {
          localEditor.putString("smb_auth", str);
          localEditor.commit();
          ActivityLocalPrinters.this.runOnUiThread(new Runnable()
          {
            public void run()
            {
              ActivityLocalPrinters.this.hideProgress();
              ActivityLocalPrinters.this.setResult(-1);
              ActivityLocalPrinters.this.finish();
            }
          });
          break;
        }
        label285:
        i = 1;
      }
    }
  }
  
  class InstallDriverThread
    extends Thread
  {
    private Printer prn;
    
    public InstallDriverThread(Printer paramPrinter)
    {
      this.prn = paramPrinter;
    }
    
    public void run()
    {
      ActivityLocalPrinters.this.runOnUiThread(new Runnable()
      {
        public void run()
        {
          ActivityLocalPrinters.this.showProgress(ActivityLocalPrinters.this.getResources().getString(2131099746));
        }
      });
      ActivityLocalPrinters.this.last_error = null;
      try
      {
        ActivityLocalPrinters.this.installDrvLibPack(this.prn.drv_name);
        if (ActivityLocalPrinters.this.last_error == null)
        {
          ActivityLocalPrinters.this.runOnUiThread(new Runnable()
          {
            public void run()
            {
              ActivityLocalPrinters.access$102(ActivityLocalPrinters.this, new ActivityLocalPrinters.AddPrinterThread(ActivityLocalPrinters.this, ActivityLocalPrinters.InstallDriverThread.this.prn, Boolean.valueOf(false)));
              ActivityLocalPrinters.this.wt.start();
            }
          });
          ActivityLocalPrinters.access$102(ActivityLocalPrinters.this, null);
          return;
        }
      }
      catch (Exception localException)
      {
        for (;;)
        {
          localException.printStackTrace();
          ActivityLocalPrinters.this.last_error = ("Internal Error: " + localException.getMessage());
          App.reportThrowable(localException);
          continue;
          ActivityLocalPrinters.this.runOnUiThread(new Runnable()
          {
            public void run()
            {
              ActivityLocalPrinters.this.hideProgress();
              ActivityLocalPrinters.this.displayLastError(new DialogInterface.OnClickListener()
              {
                public void onClick(DialogInterface paramAnonymous2DialogInterface, int paramAnonymous2Int) {}
              });
            }
          });
        }
      }
    }
  }
  
  class PrinterAdapter
    implements ListAdapter
  {
    public Context mContext;
    private List<DataSetObserver> observers = null;
    
    public PrinterAdapter(Context paramContext)
    {
      this.mContext = paramContext;
    }
    
    public boolean areAllItemsEnabled()
    {
      return true;
    }
    
    public void fireOnChanged()
    {
      if (this.observers != null)
      {
        int i = this.observers.size();
        for (int j = 0; j < i; j++) {
          ((DataSetObserver)this.observers.get(j)).onChanged();
        }
      }
    }
    
    public int getCount()
    {
      if (ActivityLocalPrinters.this.smb_stack.size() > 1) {
        return 1 + ActivityLocalPrinters.this.smb_files.size() + ActivityLocalPrinters.this.smb_printers.size();
      }
      return ActivityLocalPrinters.this.smb_files.size() + ActivityLocalPrinters.this.printers.size();
    }
    
    public Object getItem(int paramInt)
    {
      if (ActivityLocalPrinters.this.smb_stack.size() > 1)
      {
        if (paramInt == 0) {
          return null;
        }
        paramInt--;
      }
      int i = ActivityLocalPrinters.this.smb_files.size();
      if (paramInt < i) {
        return ActivityLocalPrinters.this.smb_files.elementAt(paramInt);
      }
      if (ActivityLocalPrinters.this.smb_stack.size() > 1) {
        return (Printer)ActivityLocalPrinters.this.smb_printers.elementAt(paramInt - i);
      }
      return (Printer)ActivityLocalPrinters.this.printers.elementAt(paramInt - i);
    }
    
    public long getItemId(int paramInt)
    {
      return paramInt;
    }
    
    public int getItemViewType(int paramInt)
    {
      int i = ActivityLocalPrinters.this.smb_files.size();
      if (ActivityLocalPrinters.this.smb_stack.size() > 1) {
        i++;
      }
      if (paramInt < i) {
        return 1;
      }
      return 0;
    }
    
    public View getView(int paramInt, View paramView, ViewGroup paramViewGroup)
    {
      LayoutInflater localLayoutInflater = LayoutInflater.from(this.mContext);
      if (getItemViewType(paramInt) == 0)
      {
        Printer localPrinter1 = (Printer)getItem(paramInt);
        View localView2 = localLayoutInflater.inflate(2130903064, null);
        TextView localTextView2 = (TextView)localView2.findViewById(2131230800);
        String str2 = "[" + localPrinter1.owner.login + "]";
        if ((localPrinter1.owner.nick != null) && (localPrinter1.owner.nick.length() > 0)) {
          str2 = localPrinter1.owner.nick;
        }
        if ((localPrinter1.owner.name != null) && (localPrinter1.owner.name.length() > 0)) {
          str2 = localPrinter1.owner.name;
        }
        localTextView2.setText(str2);
        ((TextView)localView2.findViewById(2131230758)).setText(localPrinter1.title);
        TextView localTextView3 = (TextView)localView2.findViewById(2131230759);
        String str3 = "";
        if ((localPrinter1.owner.country != null) && (localPrinter1.owner.country.length() > 0)) {
          str3 = localPrinter1.owner.country;
        }
        String str5;
        label302:
        int m;
        label355:
        int n;
        label386:
        View localView3;
        int i1;
        if ((localPrinter1.owner.city != null) && (localPrinter1.owner.city.length() > 0))
        {
          StringBuilder localStringBuilder2 = new StringBuilder().append(localPrinter1.owner.city);
          if (str3.length() > 0)
          {
            str5 = ", ";
            str3 = str5 + str3;
            if ((localPrinter1.location != null) && (localPrinter1.location.length() > 0)) {
              str3 = localPrinter1.location;
            }
            if (str3 == null) {
              str3 = "";
            }
            localTextView3.setText(str3);
            if (str3.length() <= 0) {
              break label560;
            }
            m = 0;
            localTextView3.setVisibility(m);
            ImageView localImageView2 = (ImageView)localView2.findViewById(2131230760);
            if (!localPrinter1.online) {
              break label567;
            }
            n = 2130837561;
            localImageView2.setBackgroundResource(n);
            localView3 = localView2.findViewById(2131230801);
            Printer localPrinter2 = ActivityCore.printer;
            i1 = 0;
            if (localPrinter2 != null)
            {
              if ((ActivityCore.printer.id == null) || (!ActivityCore.printer.id.equals(localPrinter1.id))) {
                break label574;
              }
              i1 = 1;
            }
            label444:
            if (i1 == 0) {
              break label664;
            }
          }
        }
        label664:
        for (int i2 = 0;; i2 = 4)
        {
          localView3.setVisibility(i2);
          localView2.setTag(localPrinter1);
          return localView2;
          str5 = "";
          break;
          if ((localPrinter1.owner.state == null) || (localPrinter1.owner.state.length() <= 0)) {
            break label302;
          }
          StringBuilder localStringBuilder1 = new StringBuilder().append(localPrinter1.owner.state);
          if (str3.length() > 0) {}
          for (String str4 = ", ";; str4 = "")
          {
            str3 = str4 + str3;
            break;
          }
          label560:
          m = 8;
          break label355;
          label567:
          n = 2130837560;
          break label386;
          label574:
          Vector localVector = localPrinter1.otherServices;
          i1 = 0;
          if (localVector == null) {
            break label444;
          }
          for (int i3 = 0;; i3++)
          {
            int i4 = localPrinter1.otherServices.size();
            i1 = 0;
            if (i3 >= i4) {
              break;
            }
            Printer localPrinter3 = (Printer)localPrinter1.otherServices.get(i3);
            if ((localPrinter3.id != null) && (localPrinter3.id.equals(ActivityCore.printer.id)))
            {
              i1 = 1;
              break;
            }
          }
        }
      }
      SmbFile localSmbFile = (SmbFile)getItem(paramInt);
      View localView1 = localLayoutInflater.inflate(2130903064, null);
      ImageView localImageView1 = (ImageView)localView1.findViewById(2131230760);
      TextView localTextView1 = (TextView)localView1.findViewById(2131230758);
      int i = 0;
      if (localSmbFile != null) {}
      try
      {
        int k = localSmbFile.getType();
        i = k;
      }
      catch (Exception localException)
      {
        for (;;)
        {
          localException.printStackTrace();
          App.reportThrowable(localException);
          i = 0;
        }
      }
      if ((ActivityLocalPrinters.this.smb_stack.size() > 1) && (paramInt == 0))
      {
        localImageView1.setBackgroundResource(2130837569);
        localTextView1.setText("..");
        localView1.setTag(localSmbFile);
        return localView1;
      }
      if (i == 4) {}
      for (int j = 2130837568;; j = 2130837567)
      {
        localImageView1.setBackgroundResource(j);
        String str1 = localSmbFile.getName();
        if (str1.endsWith("/")) {
          str1 = str1.substring(0, -1 + str1.length());
        }
        localTextView1.setText(str1);
        break;
      }
    }
    
    public int getViewTypeCount()
    {
      return 2;
    }
    
    public boolean hasStableIds()
    {
      return false;
    }
    
    public boolean isEmpty()
    {
      return (ActivityLocalPrinters.this.printers == null) || (ActivityLocalPrinters.this.printers.size() == 0);
    }
    
    public boolean isEnabled(int paramInt)
    {
      return true;
    }
    
    public void registerDataSetObserver(DataSetObserver paramDataSetObserver)
    {
      if (this.observers == null) {
        this.observers = new ArrayList();
      }
      if (!this.observers.contains(paramDataSetObserver)) {
        this.observers.add(paramDataSetObserver);
      }
    }
    
    public void unregisterDataSetObserver(DataSetObserver paramDataSetObserver)
    {
      if (this.observers == null) {
        return;
      }
      this.observers.remove(paramDataSetObserver);
    }
  }
  
  class SetupPrinterThread
    extends Thread
  {
    private boolean fc;
    private boolean manual;
    private Printer sprn;
    
    public SetupPrinterThread(Printer paramPrinter, boolean paramBoolean1, boolean paramBoolean2)
    {
      this.sprn = paramPrinter;
      this.fc = paramBoolean1;
      this.manual = paramBoolean2;
    }
    
    public void run()
    {
      ActivityLocalPrinters localActivityLocalPrinters1 = ActivityLocalPrinters.this;
      Runnable local1 = new Runnable()
      {
        public void run()
        {
          ActivityLocalPrinters.this.showProgress(ActivityLocalPrinters.this.getResources().getString(2131099746));
        }
      };
      localActivityLocalPrinters1.runOnUiThread(local1);
      ActivityLocalPrinters.this.last_error = null;
      Vector localVector = new Vector();
      localVector.add(this.sprn);
      if (this.sprn.otherServices != null) {
        localVector.addAll(this.sprn.otherServices);
      }
      int[] arrayOfInt = { -1, -1, -1, -1, -1 };
      int i = 0;
      int j = 0;
      final Printer localPrinter1 = (Printer)localVector.get(j);
      boolean bool1 = this.fc;
      Object localObject = null;
      if (!bool1) {}
      label338:
      label365:
      int k;
      label593:
      HttpURLConnection localHttpURLConnection;
      int i6;
      do
      {
        for (;;)
        {
          try
          {
            if (!localPrinter1.direct_address.startsWith("ipp://")) {
              continue;
            }
            IppConnection localIppConnection = new IppConnection(localPrinter1.direct_address, App.getUserAgent());
            localPrinter1.owner.login = ActivityLocalPrinters.this.prefs.getString("printer_login", null);
            localPrinter1.owner.password = ActivityLocalPrinters.this.prefs.getString("printer_password", null);
            IppMessage localIppMessage1 = new IppMessage(IppMessage.OP_GET_PRINTER_ATTRIBUTES);
            localIppMessage1.operation_attributes.add(new IppAttribute((byte)71, "attributes-charset", "utf-8"));
            localIppMessage1.operation_attributes.add(new IppAttribute((byte)72, "attributes-natural-language", "en-us"));
            localIppMessage1.operation_attributes.add(new IppAttribute((byte)69, "printer-uri", localIppConnection.getUri()));
            localIppConnection.sendRequest(localIppMessage1);
            IppMessage localIppMessage2 = localIppConnection.getResponse();
            int i2 = localIppMessage2.code;
            localObject = null;
            if (i2 != 0)
            {
              String str4 = "Error: Can't add printer. IPP error " + localIppMessage2.code;
              localObject = str4;
            }
          }
          catch (Exception localException3)
          {
            URL localURL1;
            boolean bool2;
            URL localURL2;
            Socket localSocket1;
            localException3.printStackTrace();
            localObject = "Internal Error: " + localException3.getMessage();
            App.reportThrowable(localException3);
            continue;
          }
          if (localObject != null) {
            break label1593;
          }
          if (!localPrinter1.direct_address.startsWith("ptp://")) {
            break label1508;
          }
          arrayOfInt[4] = j;
          i = 1;
          if (i == 0) {
            break label2063;
          }
          k = 4;
          if ((k < 0) || (arrayOfInt[k] != -1)) {
            break label1605;
          }
          k--;
          continue;
          if (localPrinter1.direct_address.startsWith("bjnp://"))
          {
            localURL1 = new URL(localPrinter1.direct_address.replaceAll("bjnp", "http"));
            bool2 = new BJNPSocket().check(new InetSocketAddress(localURL1.getHost(), localURL1.getPort()), 15000);
            localObject = null;
            if (!bool2) {
              localObject = "Error: Can't add printer. Network or printer error.";
            }
          }
          else
          {
            if (!localPrinter1.direct_address.startsWith("pdl://")) {
              break label593;
            }
            localURL2 = new URL(localPrinter1.direct_address.replaceAll("pdl", "http"));
            localSocket1 = new Socket();
            localSocket1.connect(new InetSocketAddress(localURL2.getHost(), localURL2.getPort()), 15000);
            localSocket1.close();
            localObject = null;
          }
        }
        if (!localPrinter1.direct_address.startsWith("wprt://")) {
          break;
        }
        String str9 = localPrinter1.direct_address.replaceAll("wprt", "http");
        URL localURL4 = new URL(str9);
        localHttpURLConnection = (HttpURLConnection)localURL4.openConnection();
        localHttpURLConnection.setConnectTimeout(15000);
        localHttpURLConnection.setReadTimeout(15000);
        localHttpURLConnection.setDoInput(true);
        localHttpURLConnection.setDoOutput(true);
        localHttpURLConnection.setUseCaches(false);
        localHttpURLConnection.setRequestMethod("POST");
        localHttpURLConnection.setRequestProperty("Content-Type", "application/soap+xml");
        localHttpURLConnection.getOutputStream().write(("<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:wsdp=\"http://schemas.xmlsoap.org/ws/2005/05/devprof\" xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/08/addressing\" xmlns:wprt=\"http://schemas.microsoft.com/windows/2006/08/wdp/print\"><soap:Header><wsa:To>" + str9 + "</wsa:To><wsa:Action>http://schemas.microsoft.com/windows/2006/08/wdp/print/GetPrinterElements</wsa:Action><wsa:MessageID>urn:uuid:" + UUID.randomUUID() + "</wsa:MessageID><wsa:ReplyTo><wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address></wsa:ReplyTo></soap:Header><soap:Body><wprt:GetPrinterElementsRequest><wprt:RequestedElements><wprt:Name>wprt:PrinterStatus</wprt:Name></wprt:RequestedElements></wprt:GetPrinterElementsRequest></soap:Body></soap:Envelope>").getBytes());
        i6 = localHttpURLConnection.getResponseCode();
        localObject = null;
      } while (i6 == 200);
      String str10 = localHttpURLConnection.getResponseMessage();
      StringBuilder localStringBuilder = new StringBuilder().append("Error: Can't add printer. HTTP error ").append(localHttpURLConnection).append(".");
      if (str10 != null) {}
      for (String str11 = " " + str10;; str11 = "")
      {
        for (;;)
        {
          localObject = str11;
          break;
          if (localPrinter1.direct_address.startsWith("lpd://"))
          {
            URL localURL3 = new URL(localPrinter1.direct_address.replaceAll("lpd", "http"));
            Socket localSocket2 = new Socket();
            localSocket2.connect(new InetSocketAddress(localURL3.getHost(), localURL3.getPort()), 15000);
            localSocket2.setSoTimeout(15000);
            OutputStream localOutputStream = localSocket2.getOutputStream();
            localOutputStream.write(2);
            localOutputStream.write((localURL3.getPath().substring(1) + "\n").getBytes());
            localOutputStream.flush();
            int i3 = localSocket2.getInputStream().read();
            localOutputStream.write(1);
            localOutputStream.write("\n".getBytes());
            localSocket2.close();
            localObject = null;
            if (i3 == 0) {
              break;
            }
            localObject = "Error: Can't add printer. LPD error " + i3;
            break;
          }
          if (localPrinter1.direct_address.startsWith("smb://"))
          {
            SmbFile localSmbFile = new SmbFile(localPrinter1.direct_address);
            try
            {
              localSmbFile.print_open("");
              localSmbFile.print_close();
              localObject = null;
            }
            catch (SmbAuthException localSmbAuthException)
            {
              for (;;)
              {
                NtlmPasswordAuthentication localNtlmPasswordAuthentication1 = (NtlmPasswordAuthentication)localSmbFile.getPrincipal();
                if (localNtlmPasswordAuthentication1.equals(NtlmPasswordAuthentication.ANONYMOUS))
                {
                  localSmbFile.setAuth(NtlmPasswordAuthentication.DEFAULT);
                }
                else
                {
                  if (localNtlmPasswordAuthentication1.equals(NtlmPasswordAuthentication.DEFAULT))
                  {
                    NtlmPasswordAuthentication localNtlmPasswordAuthentication2 = new NtlmPasswordAuthentication(ActivityLocalPrinters.this.prefs.getString("smb_auth", null));
                    if ((localNtlmPasswordAuthentication2 != null) && (!localNtlmPasswordAuthentication1.equals(localNtlmPasswordAuthentication2)))
                    {
                      localSmbFile.setAuth(localNtlmPasswordAuthentication2);
                      continue;
                    }
                  }
                  int i4 = ActivityLocalPrinters.this.smb_stack.size();
                  String str5 = null;
                  if (i4 > 1) {
                    str5 = ((SmbFile)ActivityLocalPrinters.this.smb_stack.get(1)).getServer();
                  }
                  int i5 = ActivityLocalPrinters.this.smb_stack.size();
                  String str6 = null;
                  if (i5 > 2) {
                    str6 = ((SmbFile)ActivityLocalPrinters.this.smb_stack.lastElement()).getServer();
                  }
                  if ((str5 != null) && (!localNtlmPasswordAuthentication1.getDomain().equals(str5)) && (!localNtlmPasswordAuthentication1.getDomain().equals(str6)))
                  {
                    NtlmPasswordAuthentication localNtlmPasswordAuthentication4 = new NtlmPasswordAuthentication(str5, localNtlmPasswordAuthentication1.getUsername(), localNtlmPasswordAuthentication1.getPassword());
                    localSmbFile.setAuth(localNtlmPasswordAuthentication4);
                  }
                  else
                  {
                    if ((str6 == null) || (localNtlmPasswordAuthentication1.getDomain().equals(str6))) {
                      break;
                    }
                    String str7 = localNtlmPasswordAuthentication1.getUsername();
                    String str8 = localNtlmPasswordAuthentication1.getPassword();
                    NtlmPasswordAuthentication localNtlmPasswordAuthentication3 = new NtlmPasswordAuthentication(str6, str7, str8);
                    localSmbFile.setAuth(localNtlmPasswordAuthentication3);
                  }
                }
              }
              ActivityLocalPrinters.access$102(ActivityLocalPrinters.this, null);
              ActivityLocalPrinters localActivityLocalPrinters6 = ActivityLocalPrinters.this;
              Runnable local2 = new Runnable()
              {
                public void run()
                {
                  ActivityLocalPrinters.this.hideProgress();
                  ((EditText)ActivityLocalPrinters.this.view_dialog_authorization.findViewById(2131230741)).setText("");
                  ActivityLocalPrinters.this.dialog_authorization.setButton(-1, ActivityLocalPrinters.this.getResources().getString(2131099703), new DialogInterface.OnClickListener()
                  {
                    public void onClick(DialogInterface paramAnonymous2DialogInterface, int paramAnonymous2Int)
                    {
                      String str1 = "?";
                      String str2 = ((EditText)ActivityLocalPrinters.this.view_dialog_authorization.findViewById(2131230739)).getText().toString();
                      int i = str2.indexOf("\\");
                      if (i >= 0)
                      {
                        str1 = str2.substring(0, i);
                        str2 = str2.substring(i + 1);
                      }
                      String str3 = ((EditText)ActivityLocalPrinters.this.view_dialog_authorization.findViewById(2131230741)).getText().toString();
                      int j = ActivityLocalPrinters.SetupPrinterThread.2.this.val$fprn.direct_address.indexOf("@");
                      Printer localPrinter = ActivityLocalPrinters.SetupPrinterThread.2.this.val$fprn;
                      StringBuilder localStringBuilder = new StringBuilder().append("smb://").append(URLEncoder.encode(str1 + ";" + str2 + ":" + str3)).append("@");
                      if (j < 0) {}
                      for (String str4 = ActivityLocalPrinters.SetupPrinterThread.2.this.val$fprn.direct_address.substring(6);; str4 = ActivityLocalPrinters.SetupPrinterThread.2.this.val$fprn.direct_address.substring(j + 1))
                      {
                        localPrinter.direct_address = str4;
                        ActivityLocalPrinters.access$102(ActivityLocalPrinters.this, new ActivityLocalPrinters.SetupPrinterThread(ActivityLocalPrinters.this, ActivityLocalPrinters.SetupPrinterThread.2.this.val$fprn, false, ActivityLocalPrinters.SetupPrinterThread.this.manual));
                        ActivityLocalPrinters.this.wt.start();
                        return;
                      }
                    }
                  });
                  ActivityLocalPrinters.this.dialog_authorization.show();
                }
              };
              localActivityLocalPrinters6.runOnUiThread(local2);
              return;
            }
          }
        }
        boolean bool3 = localPrinter1.direct_address.startsWith("bluetooth://");
        localObject = null;
        if (!bool3) {
          break label338;
        }
        BTDevice localBTDevice = BTAdapter.getDefault(ActivityLocalPrinters.this).getRemoteDevice(localPrinter1.direct_address.substring(12));
        try
        {
          BTSocket localBTSocket2 = localBTDevice.connectRfcommSocket();
          localBTSocket1 = localBTSocket2;
        }
        catch (Exception localException4)
        {
          for (;;)
          {
            localException4.printStackTrace();
            App.reportThrowable(localException4);
            BTSocket localBTSocket1 = null;
          }
          localObject = "Error: Can't connect to bluetooth device. You need to pair bluetooth device and Android device first.";
        }
        if (localBTSocket1 != null)
        {
          localBTSocket1.destroy();
          localObject = null;
          break label338;
        }
        break label338;
        label1508:
        if (this.manual)
        {
          arrayOfInt[0] = j;
          i = 1;
          break label365;
        }
        for (;;)
        {
          try
          {
            int i1 = ActivityLocalPrinters.this.findDriver(localPrinter1);
            if (arrayOfInt[i1] == -1) {
              arrayOfInt[i1] = j;
            }
            i = 1;
            if (i1 > 2) {
              break label365;
            }
            j++;
          }
          catch (Exception localException2)
          {
            localException2.printStackTrace();
            App.reportThrowable(localException2);
            continue;
          }
          if (j != localVector.size()) {
            break;
          }
          break label365;
          label1593:
          ActivityLocalPrinters.this.last_error = ((String)localObject);
        }
        label1605:
        final Printer localPrinter2 = (Printer)localVector.get(arrayOfInt[k]);
        if ((this.fc) && (k < 3)) {
          k = 0;
        }
        Hashtable localHashtable;
        int m;
        if (k == 0)
        {
          ActivityLocalPrinters localActivityLocalPrinters5 = ActivityLocalPrinters.this;
          Runnable local3 = new Runnable()
          {
            public void run()
            {
              ActivityLocalPrinters.this.hideProgress();
              if (!ActivityLocalPrinters.this.isFinishing())
              {
                Resources localResources = ActivityLocalPrinters.this.getResources();
                new AlertDialog.Builder(ActivityLocalPrinters.this).setIcon(17301543).setTitle(2131099857).setMessage(localResources.getString(2131099861) + "\n\n" + localResources.getString(2131099863)).setPositiveButton(2131099713, new DialogInterface.OnClickListener()
                {
                  public void onClick(DialogInterface paramAnonymous2DialogInterface, int paramAnonymous2Int)
                  {
                    ActivityLocalPrinters.this.runOnUiThread(new Runnable()
                    {
                      public void run()
                      {
                        ActivityLocalPrinters.this.showProgress(ActivityLocalPrinters.this.getResources().getString(2131099746));
                      }
                    });
                    ActivityLocalPrinters.access$1302(ActivityLocalPrinters.SetupPrinterThread.3.this.val$prn);
                    Intent localIntent = new Intent();
                    localIntent.setClass(ActivityLocalPrinters.this, ActivityDriversBrowser.class);
                    ActivityLocalPrinters.this.startActivityForResult(localIntent, 10);
                  }
                }).setNegativeButton(2131099707, new DialogInterface.OnClickListener()
                {
                  public void onClick(DialogInterface paramAnonymous2DialogInterface, int paramAnonymous2Int) {}
                }).show();
              }
            }
          };
          localActivityLocalPrinters5.runOnUiThread(local3);
          if ((k < 3) && (!this.fc) && (!this.manual)) {
            try
            {
              localHashtable = new Hashtable();
              localHashtable.put("prn_id", localPrinter2.id);
              localHashtable.put("prn_model", localPrinter2.model);
              localHashtable.put("prn_title", localPrinter2.title);
              if (k != 0)
              {
                String[] arrayOfString1 = localPrinter2.drv_name.split("\\|");
                localHashtable.put("prn_drv", arrayOfString1[0] + "-" + arrayOfString1[3]);
              }
              String[] arrayOfString2 = { "usb_MFG", "usb_MDL", "usb_CMD", "product", "pdl", "ty", "rp", "URF" };
              if (localPrinter2.capabilities != null)
              {
                Enumeration localEnumeration = localPrinter2.capabilities.keys();
                for (;;)
                {
                  if (localEnumeration.hasMoreElements())
                  {
                    String str2 = (String)localEnumeration.nextElement();
                    String str3 = (String)localPrinter2.capabilities.get(str2);
                    m = 0;
                    label1907:
                    int n = arrayOfString2.length;
                    if (m < n) {
                      if (arrayOfString2[m].equalsIgnoreCase(str2))
                      {
                        localHashtable.put(str2, str3);
                        continue;
                        ActivityLocalPrinters.access$102(ActivityLocalPrinters.this, null);
                      }
                    }
                  }
                }
              }
            }
            catch (Exception localException1)
            {
              localException1.printStackTrace();
              App.reportThrowable(localException1);
            }
          }
        }
        for (;;)
        {
          return;
          if (k < 3)
          {
            ActivityLocalPrinters localActivityLocalPrinters4 = ActivityLocalPrinters.this;
            Runnable local4 = new Runnable()
            {
              public void run()
              {
                ActivityLocalPrinters.this.hideProgress();
                if (!ActivityLocalPrinters.this.isFinishing())
                {
                  Resources localResources = ActivityLocalPrinters.this.getResources();
                  new AlertDialog.Builder(ActivityLocalPrinters.this).setIcon(17301543).setTitle(2131099857).setMessage(localResources.getString(2131099862) + "\n\n" + localResources.getString(2131099863)).setPositiveButton(2131099712, new DialogInterface.OnClickListener()
                  {
                    public void onClick(DialogInterface paramAnonymous2DialogInterface, int paramAnonymous2Int)
                    {
                      ActivityLocalPrinters.access$102(ActivityLocalPrinters.this, new ActivityLocalPrinters.AddPrinterThread(ActivityLocalPrinters.this, ActivityLocalPrinters.SetupPrinterThread.4.this.val$prn, Boolean.valueOf(true)));
                      ActivityLocalPrinters.this.wt.start();
                    }
                  }).setNeutralButton(2131099713, new DialogInterface.OnClickListener()
                  {
                    public void onClick(DialogInterface paramAnonymous2DialogInterface, int paramAnonymous2Int)
                    {
                      ActivityLocalPrinters.this.runOnUiThread(new Runnable()
                      {
                        public void run()
                        {
                          ActivityLocalPrinters.this.showProgress(ActivityLocalPrinters.this.getResources().getString(2131099746));
                        }
                      });
                      ActivityLocalPrinters.access$1302(ActivityLocalPrinters.SetupPrinterThread.4.this.val$prn);
                      Intent localIntent = new Intent();
                      localIntent.setClass(ActivityLocalPrinters.this, ActivityDriversBrowser.class);
                      ActivityLocalPrinters.this.startActivityForResult(localIntent, 10);
                    }
                  }).setNegativeButton(2131099707, new DialogInterface.OnClickListener()
                  {
                    public void onClick(DialogInterface paramAnonymous2DialogInterface, int paramAnonymous2Int) {}
                  }).show();
                }
              }
            };
            localActivityLocalPrinters4.runOnUiThread(local4);
            break;
          }
          ActivityLocalPrinters localActivityLocalPrinters3 = ActivityLocalPrinters.this;
          Runnable local5 = new Runnable()
          {
            public void run()
            {
              ActivityLocalPrinters.access$102(ActivityLocalPrinters.this, new ActivityLocalPrinters.AddPrinterThread(ActivityLocalPrinters.this, localPrinter2, Boolean.valueOf(true)));
              ActivityLocalPrinters.this.wt.start();
            }
          };
          localActivityLocalPrinters3.runOnUiThread(local5);
          break;
          m++;
          break label1907;
          if (k == 0) {}
          for (String str1 = "printer_unknown";; str1 = "printer_generic")
          {
            FlurryAgent.logEvent(str1, localHashtable);
            break;
          }
          label2063:
          if (ActivityLocalPrinters.this.last_error == null) {
            ActivityLocalPrinters.this.last_error = "Error: Uknown error";
          }
          ActivityLocalPrinters localActivityLocalPrinters2 = ActivityLocalPrinters.this;
          Runnable local6 = new Runnable()
          {
            public void run()
            {
              ActivityLocalPrinters.this.hideProgress();
              ActivityLocalPrinters.this.displayLastError(new DialogInterface.OnClickListener()
              {
                public void onClick(DialogInterface paramAnonymous2DialogInterface, int paramAnonymous2Int) {}
              });
            }
          };
          localActivityLocalPrinters2.runOnUiThread(local6);
        }
      }
    }
  }
}


/* Location:           C:\Users\Admin\Desktop\Decompiler\JAD\jd-gui-0.3.6.windows\classes_dex2jar.jar
 * Qualified Name:     com.dynamixsoftware.printershare.ActivityLocalPrinters
 * JD-Core Version:    0.7.0.1
 */